home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor2
/
loop.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
2KB
|
28 lines
(Comp.sys.hp48)
Item: 1703 by stevev@miser.uoregon.edu [Steve VanDevender]
Date: 14 Sep 1992
There are a couple of subtleties to the structure of a WHILE-REPEAT-END
clause. Between WHILE and REPEAT, you can put any sequence of objects without
having to bind them into a single program object. However, between the REPEAT
and the END, there must be only one object--if you specify multiple objects,
the user RPL compiler compiles them into a single program object. If there is
nothing between the REPEAT and the END, a null program is inserted, because
there must be at least one object to traverse if the REPEAT condition fails.
If you specify only one object, then it does not have to be surrounded with
DOCOL and SEMI, providing a significant savings in space and execution time.
Those of you who have read _HP 48 Insights, Vol. I_ may already know this.
[See page 327. -jkh-] In any conditional where a sequence of objects could be
skipped if a test fails, then the sequence is combined into a single program
object which can be traversed using the program object traversal method.
Therefore you get a 5-byte savings if only one object can be placed between
THEN-END, THEN-ELSE, ELSE-END, or REPEAT-END (and probably some others; I
don't have the book handy right now). Those of you who have dabbled in system
RPL have also encountered this; the low-level system RPL looping and branching
constructs expect single objects in conditionals but system RPL compilers
won't enforce the rule, so you have to be conscious of when a multi-object
conditional needs to be surrounded by DOCOL and SEMI.
-- Steve VanDevender stevev@greylady.uoregon.edu